[20260204] BOJ / G2 / 캔디캔디 / 한종욱 #1881
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🧷 문제 링크
https://www.acmicpc.net/problem/2878
🧭 풀이 시간
40분
👀 체감 난이도
✏️ 문제 설명
친구들의 분노의 합을 최소화해 그 값을 출력하라
🔍 풀이 방법
결국 N명의 친구들이 원하는 사탕의 합에서 M을 빼고 그 값의 평균값을 기준으로 사탕을 주고 말고를 해야한다.
평균값을 보다 적은 사탕을 원하는 친구에겐 해당 사탕만큼 미움을 받고, 평균값보다 많은 사탕을 원하는 친구에겐 평균값만큼 미움을 받아야 한다.
⏳ 회고
처음에 pq에 싹다 넣고 M만큼 연산하려고 했는데 20억이라 실패했다.